﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>H+ 后台主题UI框架 - 空白页</title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <link rel="shortcut icon" href="favicon.ico">
    <link href="css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="css/animate.css" rel="stylesheet">
    <link href="css/style.css?v=4.1.0" rel="stylesheet">
    <link href="css/plugins/jsTree/style.min.css" rel="stylesheet">
        <!-- Sweet Alert -->
    <link href="css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
    <link href="css/plugins/datapicker/datepicker3.css" rel="stylesheet">
    <!-- custom -->
    <link href="css/add-style.css" rel="stylesheet">
</head>

<body class="gray-bg">
	<div class="row">
		<div class="col-sm-12">
			<div class="ibox float-e-margins">
				<div class="tabs-container">
					<ul class="nav nav-tabs" id="myTab">
						<li class="active">
							<a data-toggle="tab" href="#tab-1"><i class="fa fa-user"></i>批次列表</a>
						</li>
						<li class="">
							<a data-toggle="tab" href="#tab-2"><i class="fa fa-user"></i>批次添加</a>
						</li>
					</ul>
					<div class="panel-body no-top-border">
						<div class="tab-content">
							<div id="tab-1" class="tab-pane active">
							</div>
							<div id="tab-2" class="tab-pane">
								<div class="row">
									<div class="col-sm-3">
										<div id="jstree2" style="margin: 10px 0 0 -10px;border: 1px solid #ccc;">
										</div>
									</div>
									<div class="col-sm-9">

									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
    <!-- 全局js -->
    <script src="js/jquery.min.js?v=2.1.4"></script>
    <script src="js/bootstrap.min.js?v=3.3.6"></script>
    <!-- jsTree plugin javascript -->
    <script src="js/plugins/jsTree/jstree.min.js"></script>

    <style>
        .jstree-open > .jstree-anchor > .fa-folder:before {
            content: "\f07c";
        }

        .jstree-default .jstree-icon.none {
            width: 0;
        }
    </style>
    <!--控制页面树元素-->
    <script>
        $(document).ready(function () {
            function demo_rename() {
                var ref = $('#jstree2').jstree(true),
                    sel = ref.get_selected();
                if (!sel.length) { return false; }
                sel = sel[0];
                ref.edit(sel);
            };
			function getParameterByName(name, url) {
				if (!url) url = window.location.href;
				name = name.replace(/[\[\]]/g, "\\$&");
				var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
					results = regex.exec(url);
				if (!results) return null;
				if (!results[2]) return '';
				return decodeURIComponent(results[2].replace(/\+/g, " "));
			}
			var del_nodes = [];
            $('#jstree2').jstree({
                'core': {
                    'check_callback': true,
					'data' : {
						'url' : '/js/demo/tree2.json',
						'data' : function (node) {
							return { 'id' : node.id };
						},
						'dataFilter':function (data) {
							var tmpArray = JSON.parse(data);
							var arr = [];
							for (var i = 0; i < tmpArray.length; i++) {
								var node = tmpArray[i];
								if ($.inArray(node.atype, ['project', 'building', 'floor', 'house']) > -1) {
									if (node.atype == 'project') {
										node.parent = '#'
									}
									if (node.id != getParameterByName("project_id")) {
										del_nodes.push(node.id)
									}
									arr.push(node);
								}
							}
							data = JSON.stringify(arr);
							return data;
						}
					}
                },
                'plugins': ['checkbox','types', 'dnd'],
                'types': {
                    'default': {
                        'icon': 'fa fa-folder'
                    },
                    'html': {
                        'icon': 'fa fa-file-code-o'
                    },
                    'svg': {
                        'icon': 'fa fa-file-picture-o'
                    },
                    'css': {
                        'icon': 'fa fa-file-code-o'
                    },
                    'img': {
                        'icon': 'fa fa-file-image-o'
                    },
                    'son': {
                        'icon': 'fa fa-file-text-o'
                    }

                }
			});
			$('#jstree2').on('loaded.jstree', function (e, data) {
				for (var i in del_nodes) {
					$('#jstree2').jstree(true).delete_node(del_nodes[i]);
				}
			})
        });


    </script>

    <!-- 自定义js -->
    <script src="js/content.js?v=1.0.0"></script>
    <script type="text/javascript">
   // 使页面中所有.modal元素在窗口可视范围之内居中

        function centerModals() {
            $('.modal').each(function (i) {
                var $clone = $(this).clone().css('display', 'block').appendTo('body');
                var top = Math.round(($clone.height() - $clone.find('.modal-content').height()) / 2);
                top = top > 50 ? top : 0;
                $clone.remove();
                $(this).find('.modal-content').css("margin-top", top - 50);
            });
        }
        // 在模态框出现的时候调用垂直居中函数

        $('.modal').on('show.bs.modal', centerModals);
        // 在窗口大小改变的时候调用垂直居中函数

        $(window).on('resize', centerModals);

    
       //--动画效果--
        $(document).ready(function () {
            $('.contact-box').each(function () {
                animationHover(this, 'pulse');
            });
			$('#tab-1 .btn-edit').click(function () {
				$('a[href="#tab-2"]').tab('show');
			})
			$("input[name=btSelectAll]").change(function() {
				if ($(this).is(':checked')) {
					$("input[name='btSelectItem']:checkbox").prop("checked", true);
				} else {   //反之 取消全选
					$("input[name='btSelectItem']:checkbox").prop("checked", false);
				}
			})
        });
    </script>
       <!-- Sweet alert -->
    <script src="js/plugins/sweetalert/sweetalert.min.js"></script>
    <script>
        //-- 小弹框--
        $('.demo2').click(function () {

            swal({
                title: "保存成功！",
                type: "success"
            });
        });

        $('.demo4').click(function () {
            swal({
                title: "您确定要删除这条信息吗",
                text: "删除后将无法恢复，请谨慎操作！",
                type: "warning",
                showCancelButton: true,
                confirmButtonColor: "#DD6B55",
                confirmButtonText: "删除",
                closeOnConfirm: false
            }, function () {
                swal("删除成功！", "您已经永久删除了这条信息。", "success");
            });
        });
    </script>
</body>

</html>
